/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-08-23 15:06:51
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2023-12-05 20:36:49
 * @FilePath: /yt-devops/lib/pages/devices/device_add/scan_device_result/scan_device_result_controller.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:get/get.dart';
import 'package:yt_devops/model/user_model.dart';
import 'package:yt_devops/pages/devices/device_list/device_list_model.dart';
import 'package:yt_devops/user_entity_manager.dart';
import 'package:yt_devops/utils/navigate_utils.dart';

import 'scan_device_result_model.dart';

class ScanDeviceResultController extends GetxController {
  ScanDeviceResult? device;

  @override
  void onInit() {
    super.onInit();
    if (Get.arguments != null) {
      device = Get.arguments!;
      update();
    }
  }

  @override
  void onReady() {}

  @override
  void onClose() {}

  bool isProductManage() {
    if (UserEntityManager().userModel.orgType ==
        OrganizationType.productManage.value) {
      return true;
    } else {
      return false;
    }
  }

  toDeviceDetail() {
    NavigateUtils.toDeviceDetail(device!.deviceId!, device!.productType!,
        device!.name ?? '', device!.connectStatus!,
        productId: device!.productId, deviceTree: null);
  }
}
